#!/bin/bash
python /etc/puppetlabs/code/environments/2023prod/modules/lzu/tests/user.py
if [ "$?" -ne "0" ]
then
  echo "ERROR"
  echo 'Error ' |mail -s "Error in access mysql afs accounts database" zhengw@ihep.ac.cn,yanxf@ihep.ac.cn
else
  /opt/puppetlabs/bin/puppet parser validate /tmp/accounts.pp
  if [ "$?" -ne "0" ]
  then
    echo 'Error ' |mail -s "Error create puppet afs accounts manifest" yanxf@ihep.ac.cn,zhengw@ihep.ac.cn
  else
    /bin/cp /tmp/accounts.pp /etc/puppetlabs/code/environments/2023prod/modules/lzu/manifests/accounts.pp
  fi
fi

#zhengw
